package io.renren.modules.deviceinfo.controller;

import java.util.Arrays;
import java.util.Map;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import io.renren.modules.deviceinfo.entity.CuttinginfoEntity;
import io.renren.modules.deviceinfo.service.CuttinginfoService;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.R;



/**
 * 
 *
 * @author chenshun
 * @email sunlightcs@gmail.com
 * @date 2023-08-27 15:06:44
 */
@RestController
@RequestMapping("deviceinfo/cuttinginfo")
public class CuttinginfoController {
    @Autowired
    private CuttinginfoService cuttinginfoService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    @RequiresPermissions("deviceinfo:cuttinginfo:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = cuttinginfoService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    @RequiresPermissions("deviceinfo:cuttinginfo:info")
    public R info(@PathVariable("id") String id){
		CuttinginfoEntity cuttinginfo = cuttinginfoService.getById(id);

        return R.ok().put("cuttinginfo", cuttinginfo);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    @RequiresPermissions("deviceinfo:cuttinginfo:save")
    public R save(@RequestBody CuttinginfoEntity cuttinginfo){
		cuttinginfoService.save(cuttinginfo);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    @RequiresPermissions("deviceinfo:cuttinginfo:update")
    public R update(@RequestBody CuttinginfoEntity cuttinginfo){
		cuttinginfoService.updateById(cuttinginfo);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    @RequiresPermissions("deviceinfo:cuttinginfo:delete")
    public R delete(@RequestBody String[] ids){
		cuttinginfoService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
